package com.ruoyi.hospital.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.hospital.mapper.CustomerBalanceMapper;
import com.ruoyi.hospital.domain.CustomerBalance;
import com.ruoyi.hospital.service.ICustomerBalanceService;

/**
 * 会员余额Service业务层处理
 * 
 * @author qichi
 * @date 2023-07-04
 */
@Service
public class CustomerBalanceServiceImpl implements ICustomerBalanceService 
{
    @Autowired
    private CustomerBalanceMapper customerBalanceMapper;

    /**
     * 查询会员余额
     * 
     * @param id 会员余额主键
     * @return 会员余额
     */
    @Override
    public CustomerBalance selectCustomerBalanceById(Long id)
    {
        return customerBalanceMapper.selectCustomerBalanceById(id);
    }

    /**
     * 查询会员余额列表
     * 
     * @param customerBalance 会员余额
     * @return 会员余额
     */
    @Override
    public List<CustomerBalance> selectCustomerBalanceList(CustomerBalance customerBalance)
    {
        return customerBalanceMapper.selectCustomerBalanceList(customerBalance);
    }

    /**
     * 新增会员余额
     * 
     * @param customerBalance 会员余额
     * @return 结果
     */
    @Override
    public int insertCustomerBalance(CustomerBalance customerBalance)
    {
        customerBalance.setCreateTime(DateUtils.getNowDate());
        return customerBalanceMapper.insertCustomerBalance(customerBalance);
    }

    /**
     * 修改会员余额
     * 
     * @param customerBalance 会员余额
     * @return 结果
     */
    @Override
    public int updateCustomerBalance(CustomerBalance customerBalance)
    {
        customerBalance.setUpdateTime(DateUtils.getNowDate());
        return customerBalanceMapper.updateCustomerBalance(customerBalance);
    }

    /**
     * 批量删除会员余额
     * 
     * @param ids 需要删除的会员余额主键
     * @return 结果
     */
    @Override
    public int deleteCustomerBalanceByIds(Long[] ids)
    {
        return customerBalanceMapper.deleteCustomerBalanceByIds(ids);
    }

    /**
     * 删除会员余额信息
     * 
     * @param id 会员余额主键
     * @return 结果
     */
    @Override
    public int deleteCustomerBalanceById(Long id)
    {
        return customerBalanceMapper.deleteCustomerBalanceById(id);
    }
}
